package com.gui.hosp.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gui.hosp.mapper.HospitalSetMapper;
import com.gui.hosp.service.HospitalSetService;
import com.gui.model.hosp.HospitalSet;
import org.springframework.stereotype.Service;

/**
 * @author GodLamp
 * @date 2022/10/13 11:46
 */
@Service
public class HospitalSetServiceImpl extends ServiceImpl<HospitalSetMapper, HospitalSet> implements HospitalSetService {
    /**
     * 根据医院编码查询对应的签名
     * @param hoscode
     * @return
     */
    @Override
    public String getSignKey(String hoscode) {
        LambdaQueryWrapper<HospitalSet> query = new LambdaQueryWrapper<>();
        query.eq(HospitalSet::getHoscode, hoscode);

        HospitalSet hospitalSet = baseMapper.selectOne(query);

        if (hospitalSet == null) {
            return null;
        }

        return hospitalSet.getSignKey();

    }
}
